package com.dotc.kotlinmvvmdemo.viewModel

import android.app.Activity
import android.app.Application
import android.content.Intent
import android.util.Log
import android.view.View
import androidx.databinding.ObservableField
import com.dotc.kotlinmvvmdemo.activity.BindingActivity
import com.dotc.kotlinmvvmdemo.activity.FunctionActivity
import com.dotc.kotlinmvvmdemo.activity.MainActivity
import com.dotc.kotlinmvvmdemo.base.BaseViewModel
import com.dotc.kotlinmvvmdemo.newPackage.NewMainActivity


/**
 * 主页面NewMainViewModel
 */
class StartViewModel(application: Application) : BaseViewModel(application) {
    var  context :Activity? = null
    val TAG = "LUO"
    val Key = ObservableField<String>("呵呵呵呵")
    init {
        Key.set("***欢迎进入MVVM封装页面***")
    }
    init {
        //只初始化一次
    }

    override fun onCreate() {
        super.onCreate()
    }

    //viewModel
    fun click1(view: View){
        Log.d(TAG,"======哈哈哈，进入所有点击事件页面======")
        context?.startActivity(Intent(context, MainActivity::class.java))
    }

    //viewModel
    fun click2(){
        Log.d(TAG,"======哈哈哈，进入封装的MVVM页面======")
        context?.startActivity(Intent(context, NewMainActivity::class.java))
    }

    //viewModel
    fun click3(){
        Log.d(TAG,"======哈哈哈，进入MVVM操作和使用页面======")
        context?.startActivity(Intent(context, FunctionActivity::class.java))
    }
    //viewModel
    fun click4(){
        Log.d(TAG,"======哈哈哈，进入绑定页面======")
        context?.startActivity(Intent(context, BindingActivity::class.java))
    }

}